import requests

from common import singleton
import string

class  DingHelper:
    def __init__(self) -> None:
        pass


    @staticmethod
    def send_msg(content, keywords = "pro_"):
        """包含关键字 _"""
        dingurl_xiaoce = "https://oapi.dingtalk.com/robot/send?access_token=82bc909d7890a6a62dc2a250df8eea25d6666b1360a79de0d61b08483774fb36"
        headers = {"Content-Type": "application/json"}
        if "_" not in content:  # 不包含关键字
            content = keywords + content

        jsonStr = {"msgtype": "text", "text": {"content": content}}
        res = requests.post(dingurl_xiaoce, json=jsonStr, headers=headers)
        return res